
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

// 首页导航菜单
class NavigatorList extends StatelessWidget {
  final List navigatorList;
  NavigatorList({Key key, this.navigatorList}) : super(key: key);

  Widget _navigatorListItem(context, item) {
    return InkWell(
      child: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(
              width: ScreenUtil().setHeight(95.0),
              height: ScreenUtil().setHeight(95.0),
              decoration: BoxDecoration(
                image: DecorationImage(
                  image: NetworkImage(item['imgUrl']),
                  fit: BoxFit.cover
                ),
                borderRadius: BorderRadius.circular(150)
              ),
            ),
            Text(item['txt'])
          ]
        ),
      ),
      onTap: () {
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      height: ScreenUtil().setHeight(352.0),
      padding: EdgeInsets.only(top: ScreenUtil().setHeight(10.0)),
      child: GridView.count(
        physics: NeverScrollableScrollPhysics(),
        crossAxisCount: 5,
        childAspectRatio: 1.0,
        // shrinkWrap: true,
        children: this.navigatorList.map((item) {
          return _navigatorListItem(context, item);
        }).toList()
      ),
    );
  }
}